from Buyer.models import QUser
from django.db import models


class Store(models.Model):
    store_name = models.CharField(max_length = 32)
    store_logo = models.ImageField(upload_to = "image")
    store_addr = models.TextField()
    store_description = models.TextField()
    store_user = models.OneToOneField(to = QUser,on_delete = models.CASCADE)


class GoodsType(models.Model):
    t_name = models.CharField(max_length=32)
    t_description = models.TextField()


class Goods(models.Model):
    goods_name = models.CharField(max_length = 32)
    goods_price = models.FloatField()
    goods_id = models.CharField(max_length = 32,blank = True,null = True)
    goods_number = models.IntegerField()
    save_time = models.IntegerField()
    save_unit = models.CharField(max_length = 32)
    publish_time = models.DateField()
    goods_description = models.TextField()
    picture = models.ImageField(upload_to = "image")
    desc_content = models.TextField()  # 商品介绍

    g_type = models.ForeignKey(to = GoodsType, on_delete = models.CASCADE)
    g_store = models.ForeignKey(to = Store, on_delete = models.CASCADE)

# Create your models here.
